﻿#ifndef MEASUREVIEW_H
#define MEASUREVIEW_H

#include "MeasureView_global.h"
#include "MeasureView/ImageView.h"
#include "MeasureView/MeasureDataSet.h"


// void MEASUREVIEW_EXPORT initMeasureViewResources();

namespace Qly {

class MEASUREVIEW_EXPORT MeasureView : public ImageView
{
public:
    MeasureView(QWidget *parent = nullptr, int defaultX = DEFAULT_IMAGE_SIZE_X, int defaultY = DEFAULT_IMAGE_SIZE_Y);
    /**
     * @brief image 获取带各种附加元素的图像。如果只是获得相机图像，建议从相机处获取图像。
     * @param decorate 是否在图像上画上网格线和中心十字还有标尺。
     * @param mark 是否在图像上画上测量的元素。
     * @return 返回图像。
     */
    QImage image(bool decorate = false, bool mark = false);
    bool saveImage(QString fileName, bool decorate = false);
    MeasureDataSet & dataSet();

    void setPixelSize(double newPixelSize_um, int method = 0);
protected:
    void paintEvent(QPaintEvent *event)  Q_DECL_OVERRIDE;
    void mousePressEvent(QMouseEvent * event)  Q_DECL_OVERRIDE;
    void mouseReleaseEvent(QMouseEvent * event)  Q_DECL_OVERRIDE;
    void mouseMoveEvent( QMouseEvent * event)  Q_DECL_OVERRIDE;
private:
    MeasureDataSet m_dataset;
};


}


#endif // MEASUREVIEW_H
